<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
<!-- 
  描述
为 Array 对象添加一个去除重复项的方法
 -->
  <script>

    Array.prototype.uniq = function () {
      // set：特点就是不可重
      const set = new Set(this)
      // 将set类型转换为Array类型
      const newArr = Array.from(set)

      return newArr
    }
    const arr = [10, 20, 30, 20, 40, 30]
    arr.uniq()


  </script>

</body>

</html>